package com.ftx.controller.test.spring.transactions;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.UUID;

/**
 * Created by fengtingxin on 2020/5/19.
 */
@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public int insert(){
        String sql = "INSERT INTO test (num, name) VALUES (?, ?)";
        String userName = UUID.randomUUID().toString().substring(0,5);
        return jdbcTemplate.update(sql,19,userName);
    }
}
